using UnityEngine;
using System.Collections;

public static class Packet
{
	private static short id = 0;
	public static short PacketIDReserved = 10;
	public static short PacketIDSection  = 100;             
	public static short AuthPacketID = (short)(PacketIDSection * id++ + PacketIDReserved);
	public static short GatewayPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved); 
	public static short CenterPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
	public static short CellPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);


    public static short WorldPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);        
	public static short ItemPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);        //5
	public static short MallPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
	public static short SNSPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);     
	public static short RadioPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved); 
	public static short DailyPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved); 
	public static short PromotPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);     //10 
	public static short AvatarPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
	public static short RankPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
	public static short AchievPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
	public static short SlotPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);   
	public static short LiaisonPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);    //15
	public static short GamePacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
    public static short TaskPacketID = (short)(PacketIDSection * (id++) + PacketIDReserved);
	public static bool  IsNeedRoot(short id){ return (id>=Packet.CellPacketID && id<Packet.CellPacketID+PacketIDSection) || (id>=Packet.GamePacketID && id<Packet.GamePacketID+PacketIDSection);}
}
public static class Proto_Achiev
{
	//achiev
	private static short id = Packet.AchievPacketID;
	public static short ReqAchievListID = id++;
	public static short RespAchievListID = id++;
	public static short ReqUserAchievID = id++;
	public static short RespUserAchievID = id++;
	public static short ReqHonourListID = id++;
	public static short RespHonourListID = id++;
	public static short ReqUserHonourID = id++;
	public static short RespUserHonourID = id++;
}

public static class Proto_Avatar
{
	private static short id = Packet.AvatarPacketID;
	public static short ReqUserAvatarID = id++;
	public static short RespUserAvatarID = id++;
	public static short ReqUpdateAvatarID = id++;
	public static short RespUpdateAvatarID = id++;
	public static short ReqUpdatePIID = id++;
	public static short RespUpdatePIID = id++;
	public static short ReqUpdateOpID = id++;
	public static short RespUpdateOpID = id++;
}


/*
 * 在ItemMessage.cs中重写
 * 
 * public static class Proto_Item
{
	private static short id = Packet.ItemPacketID;
	public static short ReqItemListID = id++;
	public static short RespItemListID = id++;
	public static short ReqBackpackID = id++;
	public static short RespBackpackID = id++;
}
 */
public static class Proto_Liaison
{
	private static short id = Packet.LiaisonPacketID;
	public static short ReqSMSVerifCodeID = id;
	public static short RespSMSVerifCodeID = id;
	public static short ReqSubmitSMSVerifCodeID = id;
	public static short RespSubmitSMSVerifCodeID = id;
}
/*
public static class Proto_Match
{
	private static short id = Packet.MatchPacketID;
	public static short ReqSignMatchID = id++;
	public static short RespSignMatchID = id++;
	public static short ReqSignedMatchID = id++;
	public static short RespSignedMatchID = id++;
	public static short ReqMatchRuntimeID = id++;
	public static short RespMatchRuntimeID = id++;
	public static short ReqMatchResultID = id++;
	public static short RespMatchResultID = id++;
	public static short ReqMatchRankID = id++;
	public static short RespMatchRankID = id++;
}*/
public static class Proto_Promot
{
	private static short id = Packet.PromotPacketID;
	public static short ReqPromotListID = id++;
	public static short RespPromotListID = id++;
	public static short ReqPromotApplyID = id++;
	public static short RespPromotApplyID = id++;
}
public static class Proto_Radio
{
	private static short id = Packet.RadioPacketID;
	public static short ReqMegaphoneID = id++;
	public static short RespMegaphoneID = id++;
	public static short ReqMessageListID = id++;
	public static short RespMessageListID = id++;
	public static short ReqFeedbackID = id++;
	public static short RespFeedbackID = id++;
}

public static class Proto_Slot
{
	private static short id = Packet.SlotPacketID;
	public static short ReqPlaySlotID = id++;
	public static short RespPlaySlotID = id++;
}

public static class Proto
{
    public static short ConnectedID = 0;
    public static short DisconnectedID = 1;
    public static short IdentifyID = 2;

	private static short id = 2;
	public static short ReqOAuthID = id++;
	public static short RespOAuthID = id++;
	public static short PingID = id++;
	public static short ExpelConnID = id++;
	public static short BroadcastID = id++;



	//private static short id = 50;
    public static short RefuseID = id++;
    public static short ErrorsID = id++;
    public static short NoticeID = id++;
    public static short ProgressID = id++;

    public static short AuthRequestID = id++;
    //public static short AuthProgressID	 = id++;
    public static short AuthResponseID = id++;
    public static short ServiceReadyID = id++;
    public static short UserBaseID = id++;
    public static short RenewInfoID = id++;
	public static short UserExitRequestID = id++;
    public static short SettingID = id++;
    public static short ChatID = id++;
    public static short GiftID = id++;
    public static short RoomInfID = id++;
    public static short FastJoinID = id++;
    public static short ReqOnlinesID = id++;
    public static short RespOnlinesID = id++;
    public static short RequestGLID = id++;
    public static short ResponseGLID = id++;
    public static short RequestGameID = id++;
    public static short JoinGameID = id++;
    public static short GameActionID = id++;
	public static short RequestEnterRoomID		= id++;
	public static short RegisterMatchRequestID	= id++;
	public static short UnRegMatchRequestID		= id++;
	public static short GameActionResponseID	= id++;
	//game message begin
	
    private static short tid = 100;
    public static short GameStartID = tid++;
    public static short GameTokenChangeID = tid++;
    public static short GameStageChangeID = tid++;
    public static short CardListID = tid++;
    public static short UserLeaveID = tid++;
    public static short GameDataID = tid++;
	public static short PlayerInfoChangeID = tid++;
	public static short FireActionID = tid++;
	public static short ActionResultID = tid++;
	public static short CompareResultID = tid++;
	public static short GameResultID = tid++;
	public static short RoundInfoID	=	tid++;
	public static short GameMessageEndID = tid++;

}


public class Connected
{
    public static short ID() { return Proto.ConnectedID; }
}

public class Disconnected
{
    public short Code;
    public static short ID() { return Proto.DisconnectedID; }
}

public class Identify
{
    public short Id;
    public short Ident;
    public short Token;
    public static short ID() { return Proto.IdentifyID; }
}
public class ReqOAuth 
{
	public int Id;
	public byte[] Secret;
	public static short ID() {return Proto.ReqOAuthID;}
}
public class  RespOAuth 
{
	public uint Id;
	public uint Code;
	public static short ID() {return Proto.RespOAuthID;}
}
public class ResPingId 
{
	public static short ID() {return Proto.PingID;}	
}

